<template>
  <div style="height:100%;">
    <Layout v-if="Object.keys(UserInfo).length&$store.state.RouterDt.length" style="height:100%;">
      <router-view v-show="IsShow" />
    </Layout>
    <div style="height:100%;" v-else>
      <router-view />
    </div>
  </div>
</template>
<style lang="scss">
// 全局样式配置
* {
  padding: 0px;
  margin: 0px;
}
ul {
  list-style: none;
}
html,
body {
  height: 100%;
  width: 100%;
}
// 路由样式
.ActiveCls {
  //color: red !important;
  //color: red;
}
// 内容全局
.RoutView_Bg {
  background: white;
}
// 阿里矢量图配置
@font-face {
  font-family: "yueticon"; /* project id 1987179 */
  src: url("//at.alicdn.com/t/font_1987179_irigng8lcrm.eot");
  src: url("//at.alicdn.com/t/font_1987179_irigng8lcrm.eot?#iefix")
      format("embedded-opentype"),
    url("//at.alicdn.com/t/font_1987179_irigng8lcrm.woff2") format("woff2"),
    url("//at.alicdn.com/t/font_1987179_irigng8lcrm.woff") format("woff"),
    url("//at.alicdn.com/t/font_1987179_irigng8lcrm.ttf") format("truetype"),
    url("//at.alicdn.com/t/font_1987179_irigng8lcrm.svg#yueticon") format("svg");
}
.yueticon {
  font-family: "yueticon" !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  width: 24px;
  margin-right: 5px;
  display: inline-block;
}
</style>
<script>
import Layout from '@/components/WebUI/Layout.vue'

export default {
  data () {
    return {
      UserInfo: {},
      IsShow: false
    }
  },
  components: {
    Layout
  },
  watch: {
    '$store.state.UserInfo' (n) {
      this.UserInfo = n;
      if (Object.keys(this.$store.state.UserInfo).length) {
        setTimeout(() => {
          this.IsShow = true
        }, 400);
        sessionStorage.setItem("AppIsShow", true)
      } else {
        this.IsShow = false
        sessionStorage.setItem("AppIsShow", false)
      }
    }
  },
  created () {
    console.log(this.$store.state.RouterDt)
    this.IsShow = sessionStorage.getItem("AppIsShow") || false
    this.UserInfo = this.$store.state.UserInfo
    if (!Object.keys(this.$store.state.UserInfo).length) {
      this.IsShow = false
      sessionStorage.setItem("AppIsShow", false)
      return;
    }
    //登陆了的用户
    //获取路由数据
  }
}
</script>